<template>
  <div>
    <div style="font-size:18px;">意见反馈列表</div>
    <hr>
    <br>
    <div style="margin-bottom: 10px;">
      <!-- <el-button size="small" type="success" @click="handleCreate()">新增</el-button> -->
    </div>
    <el-table
      :data="tableData"
      stripe border
      style="width: 100%">
      <el-table-column
        prop="name"
        label="反馈人"
        width="180">
      </el-table-column>
      <el-table-column
        prop="content"
        label="反馈内容"
        >
      </el-table-column>
      <el-table-column
        prop="createDateName"
        label="反馈日期"
        width="220">
      </el-table-column>
      <el-table-column align="center" label="操作" width="160">
        <template scope="scope">
          <el-button size="small" type="danger" @click="handleDelete(scope.row)">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
    

  </div>
</template>
<script>
    import $ from 'jquery';
    import Vue from 'vue';

  export default {
    data() {
        return {
            listQuery: {
              pageNumber: 1,
              pageSize: 10,
              param: {
                
              },
            },
            num8: 1,
            ruleForm2: {
              pass: '',
              checkPass: '',
              age: ''
            },
            labelPosition: 'right',
            formLabelAlign: {
              name: '',
              region: '',
              type: ''
            },
            dianpuName: '',
            tableData: [{
              date: '2017-12-21 15:00:05',
              name: '王小虎',
              content: '希望平台越来越好'
            }, {
              date: '2017-12-21 15:00:05',
              name: '王小虎',
              content: '希望平台越来越好'
            }, {
              date: '2017-12-21 15:00:05',
              name: '王小虎',
              content: '希望平台越来越好'
            }, {
              date: '2017-12-21 15:00:05',
              name: '王小虎',
              content: '希望平台越来越好'
            }]
        };
    },
    mounted(){
      this.fetchList()

    },
    methods: {
      handleChange(value) {
        console.log(value);
      },
      fetchList() {
        let self=this;
        self.myajax("/feedback/list",this.listQuery,(res)=>{
          console.log(res)
          if(res.code == 1000){
            self.tableData = res.data.list
          }else{

          }
        })
      },
      handleDelete(row) {
        console.log(row);
        let self = this
        this.$confirm('此操作将永久删除该意见, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          self.myajax("/feedback/deleteById",{id:row.id},(res)=>{
            console.log(res)
            if(res.code==1000){
              self.fetchList()
              self.$message({
                type: 'success',
                message: '删除成功!',
                duration: 1000
              });
            }
          })
        }).catch(() => {
        
        }); 
      },
      handleCreate() {   //新增意见
        let self=this;
        let data = {
          content: '希望提供更大的优惠',
          name: '古月',
          phone: '15594818190',
        }
        self.myajax("/feedback/create",data,(res)=>{
          console.log(res)
          if(res.code == 1000){
            self.fetchList()
          }else{

          }
        })
      },
    }
  };
</script>
<style scoped>
    .input_edit{
        width: 200px;
        float: left;
        margin-right:10px;
    }
    .cell{
        padding: 0 5px !important;
        overflow: auto;
    }
</style>
